
#include "includes.h"
#include "structs.h"
#include "declares.h"


#ifdef test_sssp_whole_on_dimacs
int main(int ac, char**av)
{

        FILE *vfile = fopen("test-dimacs.v", "r");
        FILE *efile = fopen("test-dimacs.e", "r");
        zlog_init(ZLOG_CONF_PATH);
        
        zlog_category_t *mylog = zlog_get_category("mylog");
        igraph_vector_ptr_t vertices, edges;
        igraph_vector_int_t fragtable;
        my_adjlist_t adjlist;
        igraph_vector_int_t result;
        int source=1;

        zlog_info(mylog,"loading vfile...");
        int vn=vfile2vertices(vfile,1,&vertices);
        zlog_info(mylog,"vfile is loaded");

        zlog_info(mylog,"loaded efile...");
        int en=efile2edges(efile,&edges);
        zlog_info(mylog,"efile is loaded");

        zlog_info(mylog,"constructing adjlist...");
        vector2my_adjlist(&vertices,&edges,&adjlist);
        zlog_info(mylog, "construction done");

        zlog_info(mylog,"sssp_whole begin");
        sssp_whole(&adjlist, source, &result);
        zlog_info(mylog,"sssp_whole finish");

        FILE *Result=fopen("test-dimacs.sssp_whole.dat", "w");
        for(int i=0;i<vn;++i) {
                fprintf(Result,"%d\t%d\n", i+1, VECTOR(result)[i]);
        }
        zlog_info(mylog, "Result written to %s", "test_sssp_whole_on_simple_dat");
}

#endif 

#ifdef test_sssp_whole_on_simple
int main(int ac, char**av)
{
        
        FILE *vfile = fopen("simple.v", "r");
        FILE *efile = fopen("simple.e", "r");
        zlog_init(ZLOG_CONF_PATH);
        
        zlog_category_t *mylog = zlog_get_category("mylog");
        igraph_vector_ptr_t vertices, edges;
        igraph_vector_int_t fragtable;
        my_adjlist_t adjlist;
        igraph_vector_int_t result;
        int source=1;

        zlog_info(mylog,"loading vfile...");
        int vn=vfile2vertices(vfile,1,&vertices);
        zlog_info(mylog,"vfile is loaded");

        zlog_info(mylog,"loaded efile...");
        int en=efile2edges(efile,&edges);
        zlog_info(mylog,"efile is loaded");

        zlog_info(mylog,"constructing adjlist...");
        vector2my_adjlist(&vertices,&edges,&adjlist);
        zlog_info(mylog, "construction done");

        zlog_info(mylog,"sssp_whole begin");
        sssp_whole(&adjlist, source, &result);
        zlog_info(mylog,"sssp_whole finish");
}
#endif 

